package com.yanyilu.qiubite.jpa;

import com.yanyilu.qiubite.entity.JsapiTicket;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface JsapiTicketJpa extends JpaRepository<JsapiTicket,Integer> {

    @Query(value = "select * from jsapi_ticket where app_id = :appId and end_time > :endTime",nativeQuery = true)
    JsapiTicket findJsapiTicket(@Param("endTime")Integer endTime, @Param("appId")String appId);

    @Query(value = "select * from jsapi_ticket where app_id = :appId",nativeQuery = true)
    JsapiTicket findByAppId(@Param("appId")String appId);
}
